package cn.iocoder.yudao.module.system.config.transcoder;

import cn.iocoder.yudao.module.system.config.tools.FFmpegTools;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 音频裁剪任务处理
 */
@Component
@Slf4j
public class CutterTask {

    @Resource
    FFmpegTools fFmpegTools;

    @Async("cutterTaskExecutor")
    public void run(String input, String startTime, String duration, String out) {
        log.info("音频裁剪任务开始执行 -->" + Thread.currentThread().getName() + " time:" + System.currentTimeMillis());
        try {
           fFmpegTools.audioCutter(input, startTime, duration, out);
        } catch (Exception e) {
            log.error(e.getMessage());
        }
        log.info("音频裁剪任务结束 -->" + Thread.currentThread().getName() + " time:" + System.currentTimeMillis());
    }

}
